﻿using System;

namespace _1512_number_of_good_pairs
{
    class Program
    {
        static void Main (string[] args)
        {
            int[] nums = new int[] { 1, 2, 3, 1, 1, 3 };
            Console.WriteLine (NumIdenticalPairs(nums));
        }

        public static int NumIdenticalPairs (int[] nums)
        {
            int count = 0;

            for (int i = 0;i < nums.Length - 1;i++)
            {
                for (int j = i+1;j < nums.Length;j++)
                {
                    if (nums[i] == nums[j]) count++;
                }
            }

            return count;
        }
    }
    /// <summary>
    /// 输入：nums = [1,2,3,1,1,3]
    /// 输出：4
    /// 解释：有 4 组好数对，分别是 (0,3), (0,4), (3,4), (2,5) ，下标从 0 开始

    /// </summary>

}
